<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Hello World</title>
  <script src="https://unpkg.com/vue"></script>
</head>

<body>
  <div id="root"></div>
  <script>
    Vue.createApp({
      template: `<div>
        <span v-if="isShow">{{str}}</span>
        <button @click="change">显示/隐藏</button>
      </div>`,
      data() {
        return {
          str: 'Hello world',
          isShow: true
        }
      },
      methods: {
        change(){
          this.isShow = !this.isShow
        }
      }
    }).mount('#root');
  </script>
</body>

</html>